package com.example.scrambledpuzzle;



import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;

import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;


public class ImageGallery extends Activity implements OnClickListener{

	ImageView Display;
	int resourceId;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_image_gallery);
		
		Display=(ImageView)findViewById(R.id.IVDisplay );
		  
		  ImageView im1 =(ImageView)findViewById(R.id.image1);
		  ImageView im2 =(ImageView)findViewById(R.id.image2);
		  ImageView im3 =(ImageView)findViewById(R.id.image3);
		  ImageView im4 =(ImageView)findViewById(R.id.image4);
		  ImageView im5 =(ImageView)findViewById(R.id.image5);
		  ImageView im6 =(ImageView)findViewById(R.id.image6);
		  ImageView im7 =(ImageView)findViewById(R.id.image7);
		  ImageView im8 =(ImageView)findViewById(R.id.image8);
		  ImageView im9 =(ImageView)findViewById(R.id.image9);
		  
		  
		 
		  im1.setOnClickListener(this);
		  im2.setOnClickListener(this);
		  im3.setOnClickListener(this);
		  im4.setOnClickListener(this);
		  im5.setOnClickListener(this);
		  im6.setOnClickListener(this);
		  im7.setOnClickListener(this);
		  im8.setOnClickListener(this);
		  im9.setOnClickListener(this);
		  Display.setOnClickListener(this);
		  
	}
	
	public void onClick(View v) {
		  // TODO Auto-generated method stub
		  
		  switch(v.getId()){
		  case R.id.image1:
		  Display.setImageResource(R.drawable.fox);
		  resourceId=R.drawable.fox;
		  break;
		  
		  case R.id.image2:
		  Display.setImageResource(R.drawable.cow);
		  resourceId=R.drawable.cow;
		  break;
		  
		  case R.id.image3:
		  Display.setImageResource(R.drawable.dog);
		  resourceId=R.drawable.dog;
		  break;
		  case R.id.image4:
		  Display.setImageResource(R.drawable.elephant);
		  resourceId=R.drawable.elephant;
		  break;
		  case R.id.image5:
		  Display.setImageResource(R.drawable.fish);
		  resourceId=R.drawable.fish;
		  break;
		  case R.id.image6:
		  Display.setImageResource(R.drawable.peacock);
		  resourceId=R.drawable.peacock;
		  break;
		  case R.id.image7:
			  Display.setImageResource(R.drawable.beavers);
			  resourceId=R.drawable.beavers;
			  break;
		  case R.id.image8:
			  Display.setImageResource(R.drawable.bike);
			  resourceId=R.drawable.bike;
			  break;
		  case R.id.image9:
			  Display.setImageResource(R.drawable.car);
			  resourceId=R.drawable.car;
			  break;
		  case R.id.IVDisplay:
			  Intent i= new Intent(this,Puzzle.class);
				
				i.putExtra("BitmapImage", resourceId);
				startActivity(i);
				
				break;
		  }
		  
		  }

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.image_gallery, menu);
		return true;
	}

}
